// pages/compony-pages/compony-main/compony-main.js
const app = getApp();
Page({

    /**
     * 页面的初始数据
     */
    data: {
        componyName: '',
        componyTrade: '',
        scale: '',
        finance: '',
        enterpriseLogo: '',
        teamDes: '',
        address:'',
        isVideo: false,
        mediaCoverUrl: ''
    },
    /**
     * ===================事件处理部分===================
     */
    previewImg(){
        wx.previewImage({
            current: this.data.mediaCoverUrl,
            urls: [this.data.mediaCoverUrl]
        })
    },
    clickAddMedia(){
        wx.navigateTo({
            url: '/pages/compony-pages/compony-media-list/compony-media-list'
        })
    },
    clickEdit(){
        wx.navigateTo({
            url: '/pages/compony-pages/edit-compony/edit-compony'
        })
    },
    clickAddress(){
        wx.navigateTo({
            url: '/pages/compony-pages/compony-address/compony-address'
        })
    },
    /**
     * ===================事件处理部分===================
     */

    /**
     * -------------------网络请求部分-------------------
     */

    /**
     * -------------------网络请求部分-------------------
     */
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {
        let address = app.globalData.enterpriseInfo.Province + app.globalData.enterpriseInfo.City + app.globalData.enterpriseInfo.District + app.globalData.enterpriseInfo.Address;
        let mediaCover = app.globalData.enterpriseInfo.ImageCover;
        let isVideo = false;
        if (mediaCover && mediaCover.substring(mediaCover.lastIndexOf('.') + 1) == 'mp4') {
            isVideo = true;
        }
        this.setData({
            componyName: app.globalData.enterpriseInfo.EnterpriseName,
            componyTrade: app.globalData.enterpriseInfo.IndustryName,
            finance: app.globalData.enterpriseInfo.FinancingStage,
            scale: app.globalData.enterpriseInfo.Scale,
            enterpriseLogo: app.globalData.enterpriseInfo.EnnterpriseLogo,
            teamDes: app.globalData.enterpriseInfo.TeamDes,
            address: address,
            isVideo: isVideo,
            mediaCoverUrl: mediaCover
        });
    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})